Skip to content

fix(tlock): validate drand quicknet response shapes before use (#280) - #286

Merged
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
merciiiqode:issueno280rosa
Aug 31, 2026
Merged

fix(tlock): validate drand quicknet response shapes before use (#280)#286
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
merciiiqode:issueno280rosa

Conversation

@merciiiqode

Copy link
Copy Markdown

Summary

Reject malformed Drand chain-info and beacon responses before cryptographic code uses them.

Changes

  • Added packages/tlock/src/validate.ts with assertChainInfo and assertBeacon guards.
  • validate.ts checks required fields, hex shapes, and numeric ranges (period, genesis_time, round).
  • Wired the guards into quicknet.ts (chainInfo, fetchRoundBeacon, fetchRoundSignature).
  • Exported the validators from the public index.ts.
  • Added focused, offline unit tests in validate.test.ts.
  • Registered the new test file in the test scripts.

Acceptance criteria

  • ✅ Validate required fields and numeric ranges.
  • ✅ Return a clear error for malformed responses.
  • ✅ Add focused unit tests.

Closes #280

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@merciiiqode Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@karagozemin
karagozemin merged commit 5944134 into Sub-Rosa-Issue:main Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate Drand quicknet response shapes before use

2 participants